//
//  XDMeasureViewController.m
//  Measure
//
//  Created by xieyajie on 14-3-5.
//  Copyright (c) 2014年 XDIOS. All rights reserved.
//

#import "XDMeasureViewController.h"

#import "XDMeasureLineView.h"

@interface XDMeasureViewController ()

@property (nonatomic, strong) UIImage *image;
@property (nonatomic, strong) UIImageView *imageView;

@property (nonatomic, strong) XDMeasureLineView *lineView;

@end

@implementation XDMeasureViewController

- (id)initWithImage:(UIImage *)image
{
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
        // Custom initialization
        _image = image;
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    CGFloat viewHeight = [[UIScreen mainScreen] bounds].size.height - 20;
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_7_0
    [self setEdgesForExtendedLayout:UIRectEdgeNone];
#endif
    
    _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, self.view.frame.size.width - 20, viewHeight - 20)];
    _imageView.image = self.image;
    [self.view addSubview:_imageView];
    
    _lineView = [[XDMeasureLineView alloc] initWithFrame:self.imageView.frame];
    [self.view addSubview:_lineView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
//    self.navigationController.navigationBarHidden = NO;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
